

OBJ=obj
SRC=src
EXE=bin
CPPFLAGS=-c -Wall -g -O0
CXX=g++

SRCFILES=
OBJFILES=$(OBJ)/creation.o \
		 $(OBJ)/printBinaryTree.o \
		 $(OBJ)/findNextNode.o  \
		 $(OBJ)/calcMaxMinDepth.o  \
		 $(OBJ)/calcPathToSum.o \
		 $(OBJ)/findCommonAncestor.o  \
		 $(OBJ)/createLevelLinkList.o \
		 $(OBJ)/createMinDepthTree.o \
		 $(OBJ)/createBinSearchTree.o \
		 $(OBJ)/subBinaryTree.o \
		 $(OBJ)/deleteBinSearchTreeNode.o \
		 $(OBJ)/destroyTree.o

all: 	testCreation.exe \
		testFindNext.exe \
		testCalcMaxMinDepth.exe \
		testFindCommonAncestor.exe \
		testLevelLinkList.exe \
		testBinSearchTree.exe \
		testCreateMinDepthTree.exe \
		testPathToSum.exe \
		testContainBinaryTree.exe \
		install

testCreation.exe : $(OBJ)/testCreation.o $(OBJFILES)
	$(CXX) -o $@ $^

testFindNext.exe : $(OBJ)/testFindNextNode.o $(OBJFILES)
	$(CXX) -o $@ $^

testCalcMaxMinDepth.exe : $(OBJ)/testCalcMaxMinDepth.o $(OBJFILES)
	$(CXX) -o $@ $^

testFindCommonAncestor.exe : $(OBJ)/testFindCommonAncestor.o $(OBJFILES)
	$(CXX) -o $@ $^

testLevelLinkList.exe : $(OBJ)/testLevelLinkList.o $(OBJFILES)
	$(CXX) -o $@ $^

testBinSearchTree.exe : $(OBJ)/testBinSearchTree.o $(OBJFILES)
	$(CXX) -o $@ $^

testCreateMinDepthTree.exe : $(OBJ)/testCreateMinDepthTree.o $(OBJFILES)
	$(CXX) -o $@ $^

testPathToSum.exe : $(OBJ)/testPathToSum.o $(OBJFILES)
	$(CXX) -o $@ $^

testContainBinaryTree.exe : $(OBJ)/testContainBinaryTree.o $(OBJFILES)
	$(CXX) -o $@ $^

$(OBJ)/%.o : $(SRC)/%.cpp
	$(CXX) $(CPPFLAGS) -o $@ $< 

install:
	mv *.exe $(EXE)/.

clean:
	rm -rf 	$(OBJ)/*.o $(EXE)/*.exe

